package com.ywqf_api.controller;
import cn.jpush.api.JPushClient;
import cn.jpush.api.common.resp.APIConnectionException;
import cn.jpush.api.common.resp.APIRequestException;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.Notification;
import cn.jpush.api.push.model.notification.PlatformNotification;
import com.ywqf_api.dto.exc.RegExcution;
import com.ywqf_api.dto.exc.ReturnExcution;
import com.ywqf_api.dto.exc.UserExcution;
import com.ywqf_api.dto.in.*;
import com.ywqf_api.entity.*;
import com.ywqf_api.enums.RegEnum;
import com.ywqf_api.enums.ReturnEnum;
import com.ywqf_api.enums.UserEnum;
import com.ywqf_api.service.MobileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import org.springframework.web.bind.annotation.ResponseBody;
import springfox.documentation.spring.web.json.Json;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * Created by Administrator on 2018/3/28 0028.
 */
@Api(description="mobile接口",produces="application/json")
@Controller
@RequestMapping("mobile")
public class MobileController {
    @Autowired
    private MobileService mobileService;

    private static String appKey = "3760d0556c4d523df167eedb";
    private static String masterSecret = "d58c61b7044f79e6775cdfb7";

    /**
     * 支付宝支付
     */
    @ApiOperation(value = "支付宝支付", httpMethod = "POST", notes = "支付宝支付")
    @RequestMapping(value = "/alipay" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution alipay (String title,String content) {
    return null;
 /*       AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipaydev.com/gateway.do", APP_ID, APP_PRIVATE_KEY, "json", CHARSET, ALIPAY_PUBLIC_KEY, "RSA2");
        AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
        AlipayTradePrecreateModel model = new AlipayTradePrecreateModel();
        request.setBizModel(model);
        model.setOutTradeNo(System.currentTimeMills());
        model.setTotalAmount("88.88");
        model.setSubject("Iphone6 16G");
        AlipayTradePrecreateResponse response = alipayClient.execute(request);
        System.out.print(response.getBody());
        System.out.print(response.getQrCode());*/
    }

    /**
     * 极光推送
     * @return
     */
    @ApiOperation(value = "极光推送", httpMethod = "POST", notes = "极光推送")
    @RequestMapping(value = "/jpush" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution jpush (String title,String content) {
        Map map = new HashMap();
        map.put("title",title);
        map.put("alert",content);
        JPushClient jPushClient = new JPushClient(masterSecret,appKey);
        PushPayload pushPayload = PushPayload.newBuilder()
                .setPlatform(Platform.all())
                .setAudience(Audience.all())
                .setNotification(Notification.alert(content).android(content,title,null))
                .build();
        try {
            PushResult pushResult = jPushClient.sendPush(pushPayload);
            System.out.println("success");
            System.out.println(pushResult.msg_id);
            System.out.println(pushResult.sendno);
        } catch (APIConnectionException e) {
            e.printStackTrace();
        } catch (APIRequestException e) {
            e.printStackTrace();
        }
        return new ReturnExcution(ReturnEnum.ADD_SUCCESS,null);
    }

    @ApiOperation(value = "发送短信", httpMethod = "POST", notes = "发送短信")
    @RequestMapping(value = "/sendMessage" ,method = RequestMethod.POST)
    @ResponseBody
    public UserExcution sendMessage (String telephone) {
        int num=(int)(Math.random()*9000)+1000;
        String content = "您正在使用全房网物业系统，短信验证码为："+String.valueOf(num)+"。不要告诉别人！";
        try {
           int a =  new MobileController().sendSMS(telephone,content,"");
           if (a>0){
              return new UserExcution(UserEnum.SEND_SUCCESS,String.valueOf(num));
           }else {
               return new UserExcution(UserEnum.SEND_FAIL);
           }
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new UserExcution(UserEnum.SEND_FAIL);
        } catch (UnsupportedEncodingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return new UserExcution(UserEnum.SEND_FAIL);
        }
    }

    public static int sendSMS(String Mobile,String Content,String send_time) throws MalformedURLException, UnsupportedEncodingException {
        URL url = null;
        String CorpID="SC000459";//账户名
        String Pwd="123qwe";//密码
        String send_content= URLEncoder.encode(Content.replaceAll("<br/>", " "), "GBK");//发送内容
        url = new URL("http://inolink.com/WS/BatchSend.aspx?CorpID="+CorpID+"&Pwd="+Pwd+"&Mobile="+Mobile+"&Content="+send_content+"&Cell=&SendTime="+send_time);
        BufferedReader in = null;
        int inputLine = 0;
        try {
            System.out.println("开始发送短信手机号码为 ："+Mobile);
            in = new BufferedReader(new InputStreamReader(url.openStream()));
            inputLine = new Integer(in.readLine()).intValue();
        } catch (Exception e) {
            System.out.println("网络异常,发送短信失败！");
            inputLine=-2;
        }
        System.out.println("结束发送短信返回值：  "+inputLine);
        return inputLine;
    }


    /**
     * 注册接口
     * @return
     */
    @ApiOperation(value = "注册接口", httpMethod = "POST", notes = "注册接口")
    @RequestMapping(value = "/saveLogin" ,method = RequestMethod.POST)
    @ResponseBody
    public RegExcution saveLogin (String phoneNumber,String passwordNum) {
        String phone = phoneNumber;
        String password = passwordNum;
        if (phone ==  null){
            return new RegExcution(RegEnum.PHONE_EMPTY);
        }
        if (password == null){
            return new RegExcution(RegEnum.PASSWORD_EMPTY);
        }

        int hasId = mobileService.findCustomerId(phone);
        if (hasId == 1){
            return new RegExcution(RegEnum.USER_EXIST);
        }
        int save = mobileService.saveLogin(phone,password);
        if (save == 1){
            return new RegExcution(RegEnum.REG_SUCCESS);
        }
        return new RegExcution(RegEnum.REG_FAIL);
    }

    /**
     * 获取用户信息的借口，并非登录接口
     * @param userLoginDto
     */
    @ApiOperation(value = "登陆拉数据", httpMethod = "POST", notes = "登陆拉数据")
    @RequestMapping(value = "/getUserInfo" ,method = RequestMethod.POST)
    @ResponseBody
    public UserExcution getUserInfo (UserLoginDto userLoginDto) {
        Integer type = userLoginDto.getType();
        if(type == null){
            return new UserExcution(UserEnum.GET_FAIL);
        }
        String telephone =  userLoginDto.getTelephone();
        String password = userLoginDto.getPassword();
        if(type !=0 && telephone == null){
            return new UserExcution(UserEnum.PHONE_NULL);
        }
        //如果type为1才需要验证密码，其他情况都不用验证密码
        if (type == 1){
            int customer = mobileService.getUserInfos(telephone,password);
            if(customer == 0){
                return new UserExcution(UserEnum.USER_NULL);
            }else if (customer == -1){
                return new UserExcution(UserEnum.PASSWORD_FAIL);
            }
        }else if(type == 2){
            int customer = mobileService.getUserInfos(telephone);
            if(customer == 0){
                return new UserExcution(UserEnum.USER_NULL);
            }
        }
        Map map = mobileService.getUserInfo(userLoginDto);
        if (map == null){
            return new UserExcution(UserEnum.GET_FAIL);
        }
        return new UserExcution(UserEnum.GET_SUCCESS,map);
    }

    /**
     * 获取banner
     * communityId
     * @return
     */
    @ApiOperation(value = "获取banner", httpMethod = "POST", notes = "获取banner")
    @RequestMapping(value = "/findBannerList" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findBannerList (Integer communityId) {
        List<Banner> find = mobileService.findBannerList(communityId);
        if(find == null){
            return new ReturnExcution(ReturnEnum.FIND_BANNER_NULL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 传字符串模糊查询小区和物业
     * search
     * @return
     */
    @ApiOperation(value = "传字符串模糊查询小区和物业", httpMethod = "POST", notes = "传字符串模糊查询小区和物业")
    @RequestMapping(value = "/findCommunityCorp" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findCommunityCorp (String search) {

        List<CommunityCorps> find = mobileService.findCommunityCorp(search);
        if(find == null){
            return new ReturnExcution(ReturnEnum.FIND_CORP_COMMUNITY_NULL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 传字符串模糊查询门牌号和房屋ID
     * search
     * @return
     */
    @ApiOperation(value = "传字符串模糊查询门牌号和房屋ID", httpMethod = "POST", notes = "传字符串模糊查询门牌号和房屋ID")
    @RequestMapping(value = "/findHouseIdNum" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findHouseIdNum (String search,Integer communityId) {
        List<HouseIdAndNum> find = mobileService.findHouseIdNum(search,communityId);
        if(find == null){
            return new ReturnExcution(ReturnEnum.FIND_CORP_COMMUNITY_NULL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 投诉建议
     * communityId
     * @return
     */
    @ApiOperation(value = "投诉建议", httpMethod = "POST", notes = "投诉建议")
    @RequestMapping(value = "/saveComplaint" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveComplaint (Integer customerId,String content) {
        int save = mobileService.saveComplaint(customerId,content);
        if (save>0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else {
            return new ReturnExcution(ReturnEnum.ADD_COM_FAIL,save);
        }
    }

    /**
     * 负责人员
     * communityId
     * @return
     */
    @ApiOperation(value = "负责人员", httpMethod = "POST", notes = "负责人员")
    @RequestMapping(value = "/findRoleList", method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findRoleList(Integer communityId){
        List findRoleList=mobileService.findRoleList(communityId);
        if(findRoleList == null){
            return new ReturnExcution(ReturnEnum.FIND_ROLE_USER_NULL,null);
        }
       return new ReturnExcution(ReturnEnum.FIND_SUCCESS,findRoleList);
    }

    /**
     * 查询调查问卷
     * communityId
     * @return
     */
    @ApiOperation(value = "查询调查问卷", httpMethod = "GET", notes = "查询调查问卷")
    @RequestMapping(value = "/findQuestionnaire" ,method = RequestMethod.GET)
    @ResponseBody
    public ReturnExcution findQuestionnaire (Integer communityId) {
        Map find = mobileService.findQuestionnaire(communityId);
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 查询此用户是否填写过此调查问卷
     * communityId
     * @return
     */
    @ApiOperation(value = "查询此用户是否填写过此调查问卷", httpMethod = "GET", notes = "查询此用户是否填写过此调查问卷")
    @RequestMapping(value = "/findQuestionnaireCustomer" ,method = RequestMethod.GET)
    @ResponseBody
    public ReturnExcution findQuestionnaireCustomer (Integer customerId,Integer questionId) {
        int find = mobileService.findQuestionnaireCustomer(customerId,questionId);
        if(find == 1){
            return new ReturnExcution(ReturnEnum.FIND_QUESTION_FULL,find);
        }else {
            return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
        }
    }

    /**
     * 调查问卷
     * @return
     */
    @ApiOperation(value = "调查问卷", httpMethod = "GET", notes = "调查问卷")
    @RequestMapping(value = "/saveQuestionnaire" ,method = RequestMethod.GET)
    @ResponseBody
    public ReturnExcution saveQuestionnaire (Integer customerId,Integer questionId, HttpServletResponse response, HttpServletRequest request) {
      /*  response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Access-Control-Allow-Methods", "GET");
        response.setHeader("Access-Control-Allow-Headers", "x-requested-with,content-type");*/
        int save = mobileService.saveQuestionnaire(customerId,questionId,request);
        return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
    }


    /**
     * 水费数据查询上次缴费和所属物业公司
     * @return
     */
    @ApiOperation(value = "查水费数据", httpMethod = "POST", notes = "查水费数据")
    @RequestMapping(value = "/findWaterFeeTimeAndCorp" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findWaterFeeTimeAndCorp (Integer houseId,Integer communityId) {
        Water find = mobileService.findWaterFeeTimeAndCorp(houseId,communityId);
        if(find == null){
            Water corp = mobileService.findCorp(communityId);
            if(corp == null){
                return new ReturnExcution(ReturnEnum.FIND_WATER_NULL,null);
            }
            return new ReturnExcution(ReturnEnum.FIND_ELE_SUCCESS,corp);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 电费数据查询上次缴费和所属物业公司和门牌号
     * @return
     */
    @ApiOperation(value = "查电费数据", httpMethod = "POST", notes = "查电费数据")
    @RequestMapping(value = "/findElectricityFeeTimeAndCorpAndHouseNum" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findElectricityFeeTimeAndCorpAndHouseNum (Integer houseId,Integer communityId) {
        int findHouse = mobileService.findElectricityHouse(houseId);
        if (findHouse == 0){
            return new ReturnExcution(ReturnEnum.FIND_ELE_FAIL_EMPTY_METER,null);
        }else {
            Electricity find = mobileService.findElectricityFeeTimeAndCorpAndHouseNum(houseId,communityId);
            if(find == null){
                Water corp = mobileService.findCorp(communityId);
                if(corp == null){
                    return new ReturnExcution(ReturnEnum.FIND_ELE_NULL,null);
                }
                return new ReturnExcution(ReturnEnum.FIND_ELE_SUCCESS,corp);
            }
            return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
        }
    }

    /**
     * 采暖数据查询
     * @return
     */
    @ApiOperation(value = "采暖费数据", httpMethod = "POST", notes = "采暖费数据")
    @RequestMapping(value = "/findHeatingFeeData" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findHeatingFeeData (Integer houseId,Integer communityId) {
        Map find = mobileService.findHeatingFeeData(houseId,communityId);
        if(find == null){
            return new ReturnExcution(ReturnEnum.FIND_HEATING_NULL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 物业费数据查询
     * @return
     */
    @ApiOperation(value = "物业费数据", httpMethod = "POST", notes = "物业费数据")
    @RequestMapping(value = "/findEstateFeeData" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findEstateFeeData (Integer houseId,Integer communityId) {
        Map find = mobileService.findEstateFeeData(houseId,communityId);
        if(find == null){
            return new ReturnExcution(ReturnEnum.FIND_ESTATE_NULL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }

    /**
     * 车位数据查询
     * @return
     */
    @ApiOperation(value = "车位费数据", httpMethod = "POST", notes = "车位费数据")
    @RequestMapping(value = "/findParkingFeeData" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findParkingFeeData (Integer houseId,Integer communityId,Integer parkingSpaceId) {
        Map find = mobileService.findParkingFeeData(houseId,communityId,parkingSpaceId);
        if(find == null){
            return new ReturnExcution(ReturnEnum.FIND_PARKING_NULL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,find);
    }


    /**
     * 水费缴费订单
     * @param waterFeeDto
     * @return
     */
    @ApiOperation(value = "水费缴费订单", httpMethod = "POST", notes = "水费缴费")
    @RequestMapping(value = "/saveWaterFee" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveWaterFee (WaterFeeDto waterFeeDto) {
        int save = mobileService.saveWaterFee(waterFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }

    }

    /**
     * 水费缴费
     * @param waterFeeDto
     * @return
     */
    @ApiOperation(value = "水费缴费", httpMethod = "POST", notes = "水费缴费")
    @RequestMapping(value = "/saveWaterFees" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveWaterFees (WaterFeeDto waterFeeDto) {
        int save = mobileService.saveWaterFees(waterFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }

    }
    /**
     * 电费缴费订单
     * @param electricityFeeDto
     * @return
     */
    @ApiOperation(value = "电费缴费订单", httpMethod = "POST", notes = "电费缴费")
    @RequestMapping(value = "/saveElectricityFee" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveElectricityFee (ElectricityFeeDto electricityFeeDto) {
        int save = mobileService.saveElectricityFee(electricityFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }

    /**
     * 电费缴费
     * @param electricityFeeDto
     * @return
     */
    @ApiOperation(value = "电费缴费", httpMethod = "POST", notes = "电费缴费")
    @RequestMapping(value = "/saveElectricityFees" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveElectricityFees (ElectricityFeeDto electricityFeeDto) {
        int save = mobileService.saveElectricityFees(electricityFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }
    /**
     * 采暖费缴费订单
     * @param heatingFeeDto
     * @return
     */
    @ApiOperation(value = "采暖费缴费订单", httpMethod = "POST", notes = "采暖费缴费")
    @RequestMapping(value = "/saveHeatingFee" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveHeatingFee (HeatingFeeDto heatingFeeDto) {
        int save = mobileService.saveHeatingFee(heatingFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }

    /**
     * 采暖费缴费
     * @param heatingFeeDto
     * @return
     */
    @ApiOperation(value = "采暖费缴费", httpMethod = "POST", notes = "采暖费缴费")
    @RequestMapping(value = "/saveHeatingFees" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveHeatingFees (HeatingFeeDto heatingFeeDto) {
        int save = mobileService.saveHeatingFees(heatingFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }
    /**
     * 车位费缴费订单
     * @param parkingFeeDto
     * @return
     */
    @ApiOperation(value = "车位费缴费订单", httpMethod = "POST", notes = "车位费缴费")
    @RequestMapping(value = "/saveParkingFee" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveParkingFee (ParkingFeeDto parkingFeeDto) {
        Integer spaceId = parkingFeeDto.getParkingSpaceId();
        if(spaceId == null || spaceId == 0){
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
        int save = mobileService.saveParkingFee(parkingFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }

    /**
     * 车位费缴费
     * @param parkingFeeDto
     * @return
     */
    @ApiOperation(value = "车位费缴费", httpMethod = "POST", notes = "车位费缴费")
    @RequestMapping(value = "/saveParkingFees" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveParkingFees (ParkingFeeDto parkingFeeDto) {
        int save = mobileService.saveParkingFees(parkingFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }

    /**
     * 物业费缴费订单
     * @param estateFeeDto
     * @return
     */
    @ApiOperation(value = "物业费缴费订单", httpMethod = "POST", notes = "物业费缴费")
    @RequestMapping(value = "/saveEstateFee" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveEstateFee (EstateFeeDto estateFeeDto) {
        int save = mobileService.saveEstateFee(estateFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }
    /**
     * 物业费缴费
     * @param estateFeeDto
     * @return
     */
    @ApiOperation(value = "物业费缴费", httpMethod = "POST", notes = "物业费缴费")
    @RequestMapping(value = "/saveEstateFees" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution saveEstateFees (EstateFeeDto estateFeeDto) {
        int save = mobileService.saveEstateFees(estateFeeDto);
        if(save != 0){
            return new ReturnExcution(ReturnEnum.ADD_SUCCESS,save);
        }else{
            return new ReturnExcution(ReturnEnum.ADD_FILE,null);
        }
    }

    /**
     * 物业费日历
     * @param houseId
     * @return
     */
    @ApiOperation(value = "物业费日历", httpMethod = "POST", notes = "物业费日历")
    @RequestMapping(value = "/findEstateCalendar" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findEstateCalendar (Integer houseId) {
        List list = mobileService.findEstateCalendar(houseId);
        if(list == null){
            return new ReturnExcution(ReturnEnum.FIND_FAIL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,list);
    }

    /**
     * 车位费日历
     * @param parkingSpaceId
     * @return
     */
    @ApiOperation(value = "车位费日历", httpMethod = "POST", notes = "车位费日历")
    @RequestMapping(value = "/findParkingCalendar" ,method = RequestMethod.POST)
    @ResponseBody
    public ReturnExcution findParkingCalendar (Integer parkingSpaceId) {
        List list = mobileService.findParkingCalendar(parkingSpaceId);
        if(list == null){
            return new ReturnExcution(ReturnEnum.FIND_FAIL,null);
        }
        return new ReturnExcution(ReturnEnum.FIND_SUCCESS,list);
    }


 /*   public static void main(String[] args) {
        String name = "zaq27919172";
        String password = "27919172";
        Map a = new HashMap();
        a.put("username", name);
        a.put("miyao", "111111");
        Map token = new HashMap();
        token.put("token", SecurityUitl.authentication(a));
        System.out.println(a);
        System.out.println("asdfffffff="+token);
    }*/

   /* public static void main(String[] args) {
        //连接本地的 Redis 服务
        Jedis jedis = new Jedis("localhost");
        System.out.println("连接成功");
        //查看服务是否运行
        System.out.println("服务正在运行: " + jedis.ping());
    }*/
}

